package com.eshop.utils;

import java.util.Collection;
import java.math.BigDecimal;

public class EmptyUtils
{
    public static boolean isEmpty(final String str) {
        return null == str || str.trim().length() == 0;
    }
    
    public static boolean isEmptyBigdecimal(final BigDecimal decimal) {
        return isEmpty(decimal) || decimal.compareTo(new BigDecimal(0)) == 0;
    }
    
    public static boolean isEmpty(final String str, final boolean isTrimed) {
        if (isTrimed) {
            return null == str || str.trim().length() == 0;
        }
        return null == str || str.length() == 0;
    }
    
    public static boolean isEmpty(final Collection<?> collection) {
        return null == collection || collection.size() == 0;
    }
    
    public static boolean isEmpty(final Object[] array) {
        return null == array || array.length == 0;
    }
    
    public static boolean isEmpty(final Object obj) {
        return null == obj || "".equals(obj);
    }
}
